package org.wheel.module.core.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.sql.Timestamp;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class MessageMeta implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    private int code;
    private String msg;
    private String i18nMsg;
    private boolean success;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Timestamp timestamp;
    
    public MessageMeta(int code, String msg, boolean success) {
        this.code = code;
        this.msg = msg;
        this.success = success;
        this.timestamp = new Timestamp(System.currentTimeMillis());
    }
    public MessageMeta(int code, String msg, String i18nMsg, boolean success) {
        this.code = code;
        this.msg = msg;
        this.i18nMsg = i18nMsg;
        this.success = success;
        this.timestamp = new Timestamp(System.currentTimeMillis());
    }
}
